<?php
declare (strict_types=1);

namespace app\backend\validate;

use think\Validate;

class ShopValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'require',
        'logo' => 'require',
        'name' => 'require',
        'turnover' => 'require',
        'scored' => 'require',
        'visitor' => 'require',
        'main' => 'require',
        'address' => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require' => 'id不能为空！',
        'name.require' => '请输入店铺名称！',
        'logo.require' => '请上传店铺图片！',
        'turnover.require' => '请输入店铺成交额！',
        'scored.require' => '请输入店铺评分1-5！',
        'visitor.require' => '请输入店铺访客量！',
        'main.require' => '请输入店铺主要经营内容！',
        'address.require' => '请输入店铺地址！',

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'create' => ['name', 'logo', 'turnover','scored','visitor','main','address'],
        'update' => ['id', 'name', 'turnover','scored','visitor','main','address']
    ];
}
